import {Component, EventEmitter, Input, Output} from "@angular/core";
import {NzModalService,NzModalSubject,NzNotificationService} from "ng-zorro-antd";
import { Config } from "./../../../service/config";
import { HttpServcie } from "../../../service/http.service";

import { Router } from "@angular/router";
import * as moment from "moment";
import {SpotCheckPlan} from "../../maintenancePlan/bean/spotCheckPlan";



@Component({
  selector: "information-agent",
  templateUrl: "information-agent.html",
  styleUrls: ["information-agent.scss"]
})
export class InformationAgent {

  @Input()
  inValue: any = {};

  // 定义父子传值事件
  @Output("outPut")
  public outPut = new EventEmitter();

  // 定义数据对象用于界面
  public planData:any=[];
  // 定义计划名称下拉数据类型
  public options:any=[];
  // 定义实施对象下拉数据类型
  public objects:any=[];
  // 定义多选框选择事件
  public allChecked: any = false;
  // 定义多选框
  public indeterminate: any = false;
  // 定义下拉计划值
  public planValue:string="";
  // 定义实施对象下拉值
  public objValue:string="";
  // 定义开始时间
  public startDate:any=null;
  // 定义结束时间
  public endDate:any=null;
  // 定义表头名称
  public modelTitle = "新增";
  // 定义模板类型
  public modal: any = 0;
  // 定义模板服务
  public currentModal: NzModalSubject;
  //表格
  public config: any = Config;
  // 定义初始化实体类

  // 定义总条数
  public total:any;
  // 定义选中的数据
  public clickItemDate:any=[];

  // 定义点击的行数据
  public clumeData:any;

  // 定义初始化实体类
  public spotCheckPlan:SpotCheckPlan=new SpotCheckPlan();


  constructor(

    private httpServcie: HttpServcie,
    private _notification: NzNotificationService,
    private nsub: NzModalSubject,
    private router: Router,
    private modalService: NzModalService
  ) {
    JSON.parse(window.localStorage.getItem("user"));

  }

  ngOnChanges() {
    if (this.inValue) {
      let eleValue = Object.assign({}, this.inValue);
      this.planData = eleValue.planData;
    }
  }
  // 前往
  go(data,$event){
    this.outPut.emit($event);
    this.router.navigate([data.addRessName, data]);
  }
}
